$(function () {
    let id = localStorage.getItem("roomTypeId");
    findByRoomTypeId(id);
});
function findByRoomTypeId(id) {
    $.ajax({
        url: '/back/roomType/findByRoomTypeId',
        data: {id: id},
        type: 'get',
        dataType: 'json',
        success: function (data) {
            showData(data.roomTypeModel);
        }
    })
}
//打开编辑页面 直接给里面选项进行赋值
function showData(data) {
    $("#roomTypeId").val(data.id);
    $("#roomType").val(data.name);
    $("#href").val(data.href);
}
function roomTypeEdit() {
    var data = {};
    data.id=$("#roomTypeId").val();
    data.name=$("#roomType").val();
    data.href=$("#href").val();
    $.ajax({
        url: '/back/roomType/roomTypeEdit',
        data: data,
        type: 'post',
        dataType: 'json',
        success: function (data) {
            if (data.result === 1) {
                alert("提交成功");
                $("#right").load('../back/roomType/roomTypeManage.html');
            } else {
                alert("提交失败")
            }
        }
    })
}
function cancelroomTypeEdit() {
    $("#right").load("/back/roomType/roomTypeManage.html");
}